package com.njupt.user.model;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Transient;

import com.njupt.auth.model.UserDetails;
/**
 * 用户。
 * 
 * @author lzq
 *
 */
@Entity
@Table(name="app_user")
public class User implements UserDetails,Serializable
{
	private Long id;
	private String username;
	private String password;
	private boolean enabled;
	private boolean accountNonExpired;
    private boolean accountNonLocked;
	private Long pictureAppended;
	private String realname;
	private String about;
    private String gender;
    private Date regTime;
    private String email;
    private String from;//贯籍
    private String interest;//兴趣爱好
    private String qq;//qq号码
    private String[] authorities;
    
    @Id @GeneratedValue(strategy=GenerationType.AUTO)
	public Long getId()
	{
		return id;
	}
	public void setId(Long id)
	{
		this.id = id;
	}
	@Column(nullable=false)
	public String getUsername()
	{
		return username;
	}
	public void setUsername(String username)
	{
		this.username = username;
	}
	public String getPassword()
	{
		return password;
	}
	public void setPassword(String password)
	{
		this.password = password;
	}
	public Long getPictureAppended()
	{
		return pictureAppended;
	}
	public void setPictureAppended(Long pictureAppended)
	{
		this.pictureAppended = pictureAppended;
	}
	public String getRealname()
	{
		return realname;
	}
	public void setRealname(String realname)
	{
		this.realname = realname;
	}
	public String getAbout()
	{
		return about;
	}
	public void setAbout(String about)
	{
		this.about = about;
	}
	public String getGender()
	{
		return gender;
	}
	public void setGender(String gender)
	{
		this.gender = gender;
	}
	public Date getRegTime()
	{
		return regTime;
	}
	public void setRegTime(Date regTime)
	{
		this.regTime = regTime;
	}
	public boolean isEnabled()
	{
		return enabled;
	}
	public void setEnabled(boolean enabled)
	{
		this.enabled = enabled;
	}
	/**
	 * 授权。
	 * 这个是个在认证过程中比较重要的内容，一个依据。
	 * 
	 */
	@Transient
	public String[] getAuthorities() {
		return authorities;
	}
	public void setAuthorities(String[] authorities) {
		this.authorities = authorities;
	}
	public boolean isAccountNonExpired()
	{
		return accountNonExpired;
	}
	public void setAccountNonExpired(boolean accountNonExpired)
	{
		this.accountNonExpired = accountNonExpired;
	}
	public boolean isAccountNonLocked()
	{
		return accountNonLocked;
	}
	public void setAccountNonLocked(boolean accountNonLocked)
	{
		this.accountNonLocked = accountNonLocked;
	}
	public String getEmail()
	{
		return email;
	}
	public void setEmail(String email)
	{
		this.email = email;
	}
	public String getFrom()
	{
		return from;
	}
	public void setFrom(String from)
	{
		this.from = from;
	}
	public String getInterest()
	{
		return interest;
	}
	public void setInterest(String interest)
	{
		this.interest = interest;
	}
	public String getQq()
	{
		return qq;
	}
	public void setQq(String qq)
	{
		this.qq = qq;
	}
}
